public class PekingDuck extends Duck {
    private boolean canFly;

    public PekingDuck(){
        super("白色",2.5);
        this.canFly = false;
    }

    public PekingDuck(double heavy){
        super("白色",heavy);
        this.canFly = false;
    }

    @Override
    public void fly(){
        if (canFly){
            System.out.println("北京鸭扑腾着翅膀勉强飞起来");
        }else{
            System.out.println("北京鸭太胖了，飞不起来");
        }
    }

    @Override
    public void quack(){
        System.out.println("北京鸭发出低沉的‘呱呱’叫声");
    }

    public void setHeavy(double heavy,boolean isHealthy){
        this.heavy = heavy;
        if (isHealthy){
            System.out.println("北京鸭健康重量设置为：" + heavy + "kg");
        }else{
            System.out.println("北京鸭重量设置为：" + heavy + "kg(注意：可能过重)");
        }
    }

    public void setCanFly(boolean canFly){
        this.canFly = canFly;
        System.out.println("北京鸭飞行能力设置为：" + (canFly ? "可以飞行":"不能飞行"));
    }

    public boolean isCanFly(){
        return canFly;
    }
}
